#ifndef _NNSLITE_BLIST_H_
#define _NNSLITE_BLIST_H_

#include "nnsliteglobal.h"
struct nnsliteBlist;
struct nnsliteMemoryContext;

typedef struct nnsliteBlistNode
{
	struct nnsliteBlist* blist;
	struct nnsliteBlistNode* next;
	u32 usedcount;
	u32 capacity;
	u8  buf[1];
}nnsliteBlistNode;

typedef struct nnsliteBlist
{
	u32 elemsize;
	u32 totalcount;
	u32 node_cap;
	nnsliteBlistNode* firstNode;
	nnsliteBlistNode* lastNode;
	struct nnsliteMemoryContext* mc;
}nnsliteBlist;

typedef struct nnsliteBlistIterator
{
	nnsliteBlist* blist;
	nnsliteBlistNode* curnode;
	u32 curindexInNode;
}nnsliteBlistIterator;

NNSLITE_RET nnsliteBlistCreate(nnsliteBlist* blist, u32 elemsize, u32 node_cap, struct nnsliteMemoryContext* mc);
NNSLITE_RET nnsliteBlistFree(nnsliteBlist* blist);
NNSLITE_RET nnsliteBlistPushback(nnsliteBlist* blist, const void* elem);
NNSLITE_RET nnsliteBlistInsert(nnsliteBlist* blist, const void* elem);
NNSLITE_RET nnsliteBlistBegin(nnsliteBlist* blist, nnsliteBlistIterator* iter);
NNSLITE_RET nnsliteBlistNext(nnsliteBlistIterator* iter, void* elem);
NNSLITE_RET nnsliteBlistRemove(nnsliteBlistIterator* iter);












#endif

